<%-- 
    Document   : setting
    Created on : 2016-7-28, 10:43:55
    Author     : 52461
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../../link.jsp"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body ng-app="setting" ng-controller="mainCtrl" style="padding-top: 10px;">
        <div class="container">
            <div class="col-lg-12">
                <form class="form-horizontal">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <strong><span class="glyphicon glyphicon-th"></span>&nbsp;&nbsp;基本设置</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <button ng-click="saveSetting()" class="btn btn-primary btn-sm"><i class="fa fa-save"></i>保存</button>
                        </div>
                        <div class="panel-body">

                            <div class="col-lg-12 col-md-12">
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="hospitalName" class="col-sm-4 control-label">医院名称</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" id="hospitalName" ng-model="data.hospitalName" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="pageSize" class="col-sm-4 control-label">报告纸张</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" ng-model="data.pageSize" id="pageSize" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="colLength" class="col-sm-4 control-label">报告数据长度</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" ng-model="data.colLength" id="colLength" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="sureTime" class="col-sm-4 control-label">审核验证时间</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" ng-model="data.sureTime" id="sureTime" placeholder="">
                                        </div>
                                    </div>
                                </div>

                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="medicalInfo_ip" class="col-sm-4 control-label">融合平台IP</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" ng-model="data.medicalInfo_ip" id="medicalInfo_ip" placeholder="">
                                        </div>
                                    </div>
                                </div>
                            </div>                           


                        </div>
                    </div>


                    <!--************************报告设置************************-->


                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <strong><span class="glyphicon glyphicon-th"></span>&nbsp;&nbsp;报告设置</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <button ng-click="saveReportSetting()" class="btn btn-primary btn-sm"><i class="fa fa-save"></i>保存</button>
                        </div>
                        <div class="panel-body">

                            <div class="col-lg-12 col-md-12">
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="deviceName" class="col-sm-4 control-label">设备名称</label>
                                        <div class="col-sm-8">
                                            <select ng-options="de.DEVICEMODEL as de.DEVICEMODEL for de in devices" ng-change="getDeviceConfig()" type="text" class="form-control" id="deviceName" ng-model="deviceName" placeholder=""></select>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="fontSize" class="col-sm-4 control-label">字体大小</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" ng-model="device.fontSize" id="fontSize" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="reportName" class="col-sm-4 control-label">报告名称</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" ng-model="device.reportName" id="reportName" placeholder="">
                                        </div>
                                    </div>
                                </div>

                            </div>                           


                        </div>
                    </div>
                    <!--************************HIS接口设置************************-->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <strong><span class="glyphicon glyphicon-th"></span>&nbsp;&nbsp;HIS接口设置</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <button ng-click="saveSetting()" class="btn btn-primary btn-sm"><i class="fa fa-save"></i>保存</button>
                        </div>
                        <div class="panel-body">

                            <div class="col-lg-12 col-md-12">
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="hisDbType" class="col-sm-4 control-label">数据库类型</label>
                                        <div class="col-sm-8">
                                            <select class="form-control"  ng-model="data.hisDbType">
                                                <option value="mysql"> mysql</option>
                                                <option value="oracle"> oracle</option>
                                                <option value="sqlserver">sqlserver</option>
                                            </select>
                                            <!--                                            <input type="text" id="hisDbType"  placeholder="">-->
                                        </div>
                                    </div>
                                </div>

                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="hisDbUrl" class="col-sm-4 control-label">地址</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" ng-model="data.hisDbUrl" id="hisDbUrl" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="hisDbName" class="col-sm-4 control-label">数据库名</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" ng-model="data.hisDbName" id="hisDbName" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="hisDbUser" class="col-sm-4 control-label">用户名</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" ng-model="data.hisDbUser" id="hisDbUser" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="hisDbPassword" class="col-sm-4 control-label">密码</label>
                                        <div class="col-sm-8">
                                            <input type="password" class="form-control" ng-model="data.hisDbPassword" id="hisDbPassword" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="hisDbFlag" class="col-sm-4 control-label">启用HIS接口</label>
                                        <div class="col-sm-8">
                                            <input type="checkbox"  ng-model="data.hisDbFlag" id="hisDbFlag" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                
                                 <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="queryDay" class="col-sm-4 control-label">查询天数</label>
                                        <div class="col-sm-8">
                                            <input type="text" class="form-control" ng-model="data.queryDay" id="queryDay" placeholder="默认3天内">
                                        </div>
                                    </div>
                                </div>
                            </div>                           


                        </div>
                    </div>


                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <strong><span class="glyphicon glyphicon-th"></span>&nbsp;&nbsp;其他设置</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <button ng-click="saveSetting()" class="btn btn-primary btn-sm"><i class="fa fa-save"></i>保存</button>
                        </div>
                        <div class="panel-body">

                            <div class="col-lg-12 col-md-12">


                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="checkSure" class="col-sm-4 control-label">审核验证</label>
                                        <div class="col-sm-8">
                                            <input type="checkbox"  ng-model="data.checkSure" id="checkSure" placeholder="">
                                        </div>
                                    </div>
                                </div>

                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="brcodeStartChar" class="col-sm-4 control-label">条码开头</label>
                                        <div class="col-sm-8">
                                            <input  class="form-control" type="text"  ng-model="data.brcodeStartChar" id="brcodeStartChar" placeholder="">
                                        </div>
                                    </div>
                                </div>

                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="patientIdStartChar" class="col-sm-4 control-label">病历号开头</label>
                                        <div class="col-sm-8">
                                            <input  class="form-control" type="text"  ng-model="data.patientIdStartChar" id="patientIdStartChar" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                
                                 <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="lisCenterFlag" class="col-sm-4 control-label">是否为检验中心</label>
                                        <div class="col-sm-8">
                                            <input  class="form-control" type="text"  ng-model="data.lisCenterFlag" id="lisCenterFlag" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="lisCenterUrl" class="col-sm-4 control-label">检验中心地址</label>
                                        <div class="col-sm-8">
                                            <input  class="form-control" type="text"  ng-model="data.lisCenterUrl" id="lisCenterUrl" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="autoSendLisCenter" class="col-sm-4 control-label">自动发送到检验中心</label>
                                        <div class="col-sm-8">
                                            <input  class="form-control" type="checkbox"  ng-model="data.autoSendLisCenter" id="autoSendLisCenter" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                 <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="autoGetDataForCenter" class="col-sm-4 control-label">从中心获取数据</label>
                                        <div class="col-sm-8">
                                            <input  class="form-control" type="checkbox"  ng-model="data.autoGetDataForCenter" id="autoGetDataForCenter" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                
                                 <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="autoGetDataForCenter" class="col-sm-4 control-label">审核/检验医生相同验证</label>
                                        <div class="col-sm-8">
                                            <input  class="form-control" type="checkbox"  ng-model="data.sh_check" id="sh_check" placeholder="">
                                        </div>
                                    </div>
                                </div>
                            </div>                           


                        </div>
                    </div>
                    
                    
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <strong><span class="glyphicon glyphicon-th"></span>&nbsp;&nbsp;医院自定义设置</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <button ng-click="saveSetting()" class="btn btn-primary btn-sm"><i class="fa fa-save"></i>保存</button>
                        </div>
                        <div class="panel-body">

                            <div class="col-lg-12 col-md-12">


                                <div class="col-lg-12">
                                    <div class="form-group">
                                        <label for="hisChartTitle" class="col-sm-4 control-label">统计类型定义</label>
                                        <div class="col-sm-8">
                                            <textarea  class="form-control" type="text" style="height: 100px;border: 1px #cfdadd solid"  ng-model="data.hisChartTitle" id="hisChartTitle" placeholder="">
                                            </textarea>
                                        </div>
                                    </div>
                                </div>

                            </div>                           


                        </div>
                    </div>
                    
                    
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <strong><span class="glyphicon glyphicon-th"></span>&nbsp;&nbsp;全局样式设定</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <button ng-click="saveSetting()" class="btn btn-primary btn-sm"><i class="fa fa-save"></i>保存</button>
                        </div>
                        <div class="panel-body">

                            <div class="col-lg-12 col-md-12">

                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label for="gob_font_weight" class="col-sm-4 control-label">全局字体加粗</label>
                                        <div class="col-sm-8">
                                            <input  class="form-control" type="checkbox"  ng-model="data.gob_font_weight" id="gob_font_weight" placeholder="">
                                        </div>
                                    </div>
                                </div>
                                

                            </div>                           


                        </div>
                    </div>
                </form>
            </div>
        </div>
    </body>
</html>
<script>

    angular.module("setting", ['baseModule'])
            .controller("mainCtrl", ["$scope", "base", function ($scope, base) {

                    $scope.getSetting = function () {

                        base.post("getInfo").get(function (data) {
                            if (data) {
                                for (s in data) {
                                    if (data[s] == "true") {
                                        data[s] = true;
                                    }
                                }
                            }
                            $scope.data = data;
                            $scope.getDevices();

                        })
                    }



                    $scope.saveSetting = function () {

                        base.post("saveInfo", $scope.data).get(function (data) {

                            if (data == "true") {
                                steveAl("保存成功", 1000);
                            } else {
                                steveAl("保存失败", 1000);
                            }

                        });
                    }
                    //保存报告设置
                    $scope.saveReportSetting = function () {
                        console.log("------------保存报告设置-----------------");
                        base.post("saveReportSet", {name: $scope.deviceName, value: escape(angular.toJson($scope.device))}).get(function (data) {
                            if (data == 'true') {

                                steveAl("保存成功", 1000);
                            } else {
                                steveAl("保存失败", 1000);
                            }

                        })

                    }
                    //获取设备类型
                    $scope.getDevices = function () {
                        base.post("getDevices").get(function (data) {
                            $scope.devices = data;

                        })
                    }
                    $scope.getDeviceConfig = function () {
                        base.post("getDeviceConfig", {name: $scope.deviceName}).get(function (data) {

                            if (data.length) {
                                $scope.device = angular.fromJson(unescape(data));
                            }

                        })
                    }
                    $scope.getSetting();

                }]);
</script>
